#打印
print('hello world')

#变量，打印函数
message='hello python world'
print(message)

#重新定义变量，变量值刷新
message='a'
print(message)

#人名函数首字母大写
name='ada lovelace'
print(name.title())

#全部大小写函数
name='ada lovelace'
print(name.upper())
print(name.lower())

#合并字符串
first_name='ada'
last_name='lovelace'
full_name=first_name+' '+last_name

print(full_name)

#通过打印合并，函数处理变量
first_name='ada'
last_name='lovelace'
full_name=first_name+' '+last_name

print('Hello, '+full_name.title()+'!')

#缩进，换行
print('python')
print('\tpython')
print('\npython')
print('\\ntpython')
print('languages:\n\tpython\n\tC\n\tjavaScript')

#删除空白,暂时删除字符串末尾的空白
favorite_language='python '
print(favorite_language)
print(favorite_language.rstrip())
print(favorite_language)

#永久删除字符串末尾的空白
favorite_language='python '
favorite_language=favorite_language.rstrip()
print(favorite_language)

#删除提出字符串开头的空白
favorite_language=' python'
print(favorite_language.strip())

#删除开头、末尾、两端空白函数
favorite_language= ' a '
print(favorite_language.rstrip())
print(favorite_language.lstrip())
print(favorite_language.strip())

#数字
a=2+3
b=3-2
c=2*3
d=3/2
e=3**2#三的二次方
f=2+3*4
g=(2+3)*4
print(a,b,c,d,e,f,g)

#浮点数
a=0.1+0.1
b=0.2+0.2
c=2*0.1
d=2*0.2
print(a,b,c,d)

#数值转化为字符串str()函数
age=23
message='Happy '+str(age)+'rd Birthday'
print(message)

# 2-1 信息储存到变量，将其打印出来
a="I love you 3000 times"
print(a)
# 2-2 修改变量，再打印
a='llla 逗你玩儿'
print(a)

# 2-3 个性化消息
a='Eric'
print("Hello "+a+", would you like to learn some Python today?")

# 2-4 人名，小写，大写，首字母大写的方式显示
a='Mary antoine'
print(a.lower())
print(a.upper())
print(a.title())

# 2-5 双引号
print('Shakespeare thus said: "Love all, trust a few, do wrong to none."')

# 习题2-6 重复2-5，变量message，变量famous_people

famous_people='Shakespeare'
message=' thus said: "Love all, trust a few, do wrong to none."'
print('\n'+famous_people+message)



# 习题2-7 /t,/n，打印这个人名，lstrip, rstrip, strip

famous_people='a\n\t\tShakespeare\tb\tc\nd'

print(famous_people)
famous_people='\n\t\tShakespeare\t\t\n'

# lstrip()：去掉前面换行及空格, 前面的\n\t\t全部去除

famous_people_l=famous_people.lstrip()
print("lstrip(): "+famous_people_l)

# rstrip，删除了后面的\t\t，但没有删除\n
famous_people_r=famous_people.rstrip()
print("rstrip(): "+famous_people_r)

# 0208习题2-8，加减乘除=8
print(3+5)
print(9-1)
print(4*2)
print(16/2)#神奇，小数点为啥会保留一位


# 0208习题2-9
a=22
print(a.__str__()+' is my favorite number!')

# 0209习题2-10 添加注释
a=22
# 表达最喜欢的数字
print(a.__str__()+' is my favorite number!')

# 2-11 Python之禅

import this